import javax.swing.ImageIcon;


public class Chance extends Block{
	private ImageIcon[] ii;
	private String myName = super.getMyName();
	
	public Chance(String name, int Location) {
		super(name, Location);
		ii = new ImageIcon[16];
		ii[0] = new ImageIcon("images/Scroll/chance10.gif");
		ii[1] = new ImageIcon("images/Scroll/chance2.gif");
		ii[2] = new ImageIcon("images/Scroll/chance1.gif");
		ii[3] = new ImageIcon("images/Scroll/chance11.gif");
		ii[4] = new ImageIcon("images/Scroll/chance9.gif");
		ii[5] = new ImageIcon("images/Scroll/chance12.gif");
		ii[6] = new ImageIcon("images/Scroll/chance13.gif");
		ii[7] = new ImageIcon("images/Scroll/chance14.gif");
		ii[8] = new ImageIcon("images/Scroll/chance15.gif");
		ii[9] = new ImageIcon("images/Scroll/chance16.gif");
		ii[10] = new ImageIcon("images/Scroll/chance8.gif");
		ii[11] = new ImageIcon("images/Scroll/chance3.gif");
		ii[12] = new ImageIcon("images/Scroll/chance5.gif");
		ii[13] = new ImageIcon("images/Scroll/chance4.gif");
		ii[14] = new ImageIcon("images/Scroll/chance7.gif");
		ii[15] = new ImageIcon("images/Scroll/chance6.gif");
	}
	public void setMyName(String myName) {
		this.myName = myName;
	}
	
	public String getMyName() {
		return myName;
	}
	
	public void getNumber(Player[] player, Integer[] orderTurn, int turn, int Location, int Chance, monopolyGUI ui){
		switch(Chance){
			case 1:
				ui.setUI(ii[0]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-1500000);
				break;
			
			case 2:
				ui.setUI(ii[1], true, 39);
				ui.setnCounter1(0);
				break;
				
			case 3:
				ui.setUI(ii[2], true, 0);
				ui.setnCounter1(0);
				break;
				
			case 4:
				ui.setUI(ii[3]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1500000);
				break;
				
			case 5:
				ui.setUI(ii[4]);
				//get out of jail free.
				break;
				
			case 6:
				ui.setUI(ii[5]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-150000);
				break;
				
			case 7:
				ui.setUI(ii[6], false, 3);
				ui.setnCounter1(player[orderTurn[turn]].getToken().getLocation());
				break;
				
			case 8:
				ui.setUI(ii[7]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
				
			case 9:
				ui.setUI(ii[8]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-200000);
				break;
				
			case 10:
				ui.setUI(ii[9]);
				ui.setToJail(true);
				player[orderTurn[turn]].setJail(true);
				ui.setnCounter1(player[orderTurn[turn]].getToken().getLocation());
				break;
				
			case 11:
				ui.setUI(ii[10]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+500000);
				break;
				
			case 12:
				ui.setUI(ii[11], true, 11);
				ui.setnCounter1(0);
				break;
				
			case 13:
				ui.setUI(ii[12], true, 15);
				ui.setnCounter1(0);
				break;
				
			case 14:
				ui.setUI(ii[13], true, 24);
				ui.setnCounter1(0);
				break;
				
			case 15:
				ui.setUI(ii[14]);
				//pay 400k per apartment, 1.5m per hotel
				break;
				
			case 16:
				ui.setUI(ii[15]);
				//pay 250k , 1m per hotel
				break;
		}
	}
	public void getNumber(Player[] player, Integer[] orderTurn, int turn, int Location, int Chance, monopolySolo ui){
		switch(Chance){
			case 1:
				ui.setUI(ii[0]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-1500000);
				break;
			
			case 2:
				ui.setUI(ii[1], true, 39);
				ui.setnCounter1(0);
				break;
				
			case 3:
				ui.setUI(ii[2], true, 0);
				ui.setnCounter1(0);
				break;
				
			case 4:
				ui.setUI(ii[3]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1500000);
				break;
				
			case 5:
				ui.setUI(ii[4]);
				//get out of jail free.
				break;
				
			case 6:
				ui.setUI(ii[5]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-150000);
				break;
				
			case 7:
				ui.setUI(ii[6], false, 15);
				ui.setnCounter1(player[orderTurn[turn]].getToken().getLocation());
				break;
				
			case 8:
				ui.setUI(ii[7]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+1000000);
				break;
				
			case 9:
				ui.setUI(ii[8]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()-200000);
				break;
				
			case 10:
				ui.setUI(ii[9]);
				ui.setToJail(true);
				player[orderTurn[turn]].setJail(true);
				ui.setnCounter1(player[orderTurn[turn]].getToken().getLocation());
				break;
				
			case 11:
				ui.setUI(ii[10]);
				player[orderTurn[turn]].setMoney(player[orderTurn[turn]].getMoney()+500000);
				break;
				
			case 12:
				ui.setUI(ii[11], true, 11);
				ui.setnCounter1(0);
				break;
				
			case 13:
				ui.setUI(ii[12], true, 15);
				ui.setnCounter1(0);
				break;
				
			case 14:
				ui.setUI(ii[13], true, 24);
				ui.setnCounter1(0);
				break;
				
			case 15:
				ui.setUI(ii[14]);
				//pay 400k per apartment, 1.5m per hotel
				break;
				
			case 16:
				ui.setUI(ii[15]);
				//pay 250k , 1m per hotel
				break;
		}
	}
}
